package com.haochang.chunkvod.controller.adapter.order;

import java.util.List;

import com.haochang.base.BaseTextView;
import com.haochang.chunkvod.R;
import com.haochang.chunkvod.app.utils.CollectionUtils;
import com.haochang.chunkvod.app.utils.SaleUtils;
import com.haochang.chunkvod.controller.adapter.base.BaseAdapterHelper;
import com.haochang.chunkvod.controller.adapter.base.QuickAdapter;
import com.haochang.chunkvod.model.BaseInfo;
import com.haochang.chunkvod.model.order.RoomInfo;
import com.haochang.chunkvod.tools.vod.other.DrawableUtils;

import android.content.Context;

/**
 * 点餐备注查询适配器
 */
public class RemarkQueryAdapter extends QuickAdapter
{
	private Context mContext;
	private List<BaseInfo> baseInfoList;

	public RemarkQueryAdapter(Context context, int layoutResId, List data)
	{
		super(context, layoutResId, data);
		mContext = context;
	}

	public void setBaseInfoList(List<BaseInfo> baseInfoList)
	{
		this.baseInfoList = baseInfoList;
	}

	@Override
	protected void convert(BaseAdapterHelper helper, final Object object)
	{
		final RoomInfo item = (RoomInfo) object;
		final BaseTextView tv_roomStatus = helper.getView(R.id.tv_roomStatus);
		helper.setText(R.id.tv_roomNum, item.getRoomNum());
		if (item.getRoomPeopleCount() > 0)
			helper.setText(R.id.tv_mark, "预收" + SaleUtils.getSaleString(item.getRoomPeopleCount()) + "。" + item.getRoomRemark());
		else
			helper.setText(R.id.tv_mark, item.getRoomRemark());

		if (CollectionUtils.isEmpty(baseInfoList))
			DrawableUtils.setDefaultRoomStyle(mContext, item.getRoomStatus(), item.getUsage(), helper.getView(), tv_roomStatus);
		else
			DrawableUtils.setRoomStyleByServiceNoClick(mContext, item.getRoomStatus(), item.getUsage(), helper.getView(), tv_roomStatus, baseInfoList);
	}
}
